@extends('wap.layouts.master')
@section('title','约战服务')

@section('content')

<div class="aw-main aw-match aw-match-challenge aw-pb170">
	<!--主队信息-开始-->
	<ul class="aw-assest-form aw-assest-ranks-list aw-bg-fff aw-border-none">
		<li class="aw-form-li aw-form-li-title"><p>主队信息</p></li>
		<li class="aw-ranks-li aw-ranks-li-img">
			<div class="aw-li-img"><img :src="info_main_team.img ? info_main_team.img : '/img/default_160_160.png'" onerror="javascript:this.src='/img/default_160_160.png';"></div>
			<div class="aw-li-info">
				<div class="aw-info-title">@{{info_main_team.name}}</div>
				<div class="am-info-more">
					<p><span>参赛人数：</span>@{{invite_res.join_num}}</p>
					<p><span>平均年龄：</span>@{{invite_res.avg_age}}</p>
					<p><span>队服颜色：</span>@{{invite_res.colour}}</p>
				</div>
			</div>
		</li>
		<li class="aw-ranks-li aw-text-center">
			<div class="aw-li-info">
				<p><span>主队要求</span></p>
				<p>@{{invite_res.desc}}</p>
			</div>
		</li>
	</ul>
	<!--主队信息-结束-->
	<!--填写客队信息-开始-->
	<ul class="aw-assest-form aw-bg-fff aw-mt10">
		<li class="aw-form-li aw-form-li-title"><p>客队信息</p></li>
		<li class="aw-form-li">
			<div class="aw-left">我的球队</div>
			<div class="aw-conter aw-text-right">@{{info_slave_team.name}}</select>
			</div>
		</li>
		<li class="aw-form-li">
			<div class="aw-left">参数人数</div>
			<div class="aw-conter aw-text-right">
				<input type="text" id="people_number" :value="info_slave_team.people_number" v-model="info_slave_team.people_number">
			</div>
		</li>
		<li class="aw-form-li">
			<div class="aw-left">平均年龄</div>
			<div class="aw-conter aw-text-right">
				<input type="text" id="avg_age" :value="info_slave_team.avg_age" v-model="info_slave_team.avg_age">
			</div>
		</li>
		<li class="aw-form-li">
			<div class="aw-left">队服颜色</div>
			<div class="aw-conter aw-text-right">
				<input type="text" id="colour" :value="info_slave_team.colour" v-model="info_slave_team.colour">
			</div>
		</li>
		<li class="aw-form-li aw-textarea">
			<div class="aw-left">客队要求</div>
			<div class="aw-conter">
				<textarea placeholder="请输入您的要求" id="desc" :value="info_slave_team.desc" v-model="info_slave_team.desc"></textarea>
			</div>
		</li>
	</ul>
	<!--填写客队信息-结束-->
</div>
<div class="aw-match-vs">
	<!--vs信息-开始-->
	<ul class="aw-assest-list aw-assest-vs-match">
		<li class="aw-bg-fff aw-list-li">
			<div class="aw-li-title aw-vs-title">
				<div class="aw-title-left">@{{invite_res.game_day}}&nbsp;&nbsp;@{{invite_res.start_time}}-@{{invite_res.end_time}}</div>
				<div class="aw-title-right">@{{address.storefront_name}}<span>｜</span>@{{address.type_text}} (@{{address.number}}号)</div>
			</div>
			<div class="aw-li-desc aw-vs-desc">
				<div class="aw-vs-desc-zhandui aw-pr20">
					<span class="aw-desc-zhandui-img"><img :src="info_main_team.img ? info_main_team.img : '/img/default_160_160.png'" onerror="javascript:this.src='/img/default_160_160.png';"></span>
					@{{info_main_team.name}}
				</div>
				<div class="aw-vs-desc-zhandui aw-pl20">
					<span class="aw-desc-zhandui-img"><img :src="info_slave_team.img ? info_slave_team.img : '/img/default_160_160.png'" onerror="javascript:this.src='/img/default_160_160.png';"></span>
					@{{info_slave_team.name}}
				</div>
				<p class="aw-color-FF5450 aw-vs-desc-vs">VS</p>
			</div>
		</li>
	</ul>
	<!--主队信息-结束-->
</div>
<div class="aw-bg-191E1C aw-foot-btn aw-foot-btn1">
	合计：<span class="aw-color-2">￥@{{invite_res.money}}</span>
	<a href="javascript:;" v-on:click="Submit_Appoint()" class="aw-assest-btn aw-btn-bgcolor-lvse">支付订单</a>
</div>


@section('pagejs')
@parent
<script type="text/javascript">
var MJS_URLArry=URLArry;
if(MJS_URLArry.invite_id<1||!MJS_URLArry.invite_id){
	window.history.go(-1);//返回上一页
}
var MJS_User_Info=Get_Browser_Cache('user_info')
var info_selected_storefront=Get_Browser_Cache('date')
console.log(111111111)
console.log(info_selected_storefront)
var user_team_list=MJS_User_Info.team_list.list;
var eq;
for(var i=0;i<user_team_list.length;i++){
	console.log(1111111111)
	var is_admin=user_team_list[i].is_admin;
	if(is_admin==1){
		eq=i;
	}
}
var Vue_Data={
	address:{},//主队信息
	info_main_team:{},//主队信息
	info_slave_team:user_team_list[eq],//客队信息
	info_selected:{},
	invite_res:{},
};
//获取比赛时段列表
var AD_info={
	api:'/api/team/game-info',
	form_data:{invite_id:MJS_URLArry.invite_id},
	tips:false,
}
getData(AD_info,function(ajax_data){
	Vue_Data.address=ajax_data.address;
	Vue_Data.info_main_team=ajax_data.info_main_team;
	Vue_Data.invite_res=ajax_data.invite_res;
})
vm=new Vue({
	el:'#Vue-body',
	data:Vue_Data,
	methods:{
		Submit_Appoint:function(test){
			//下一步
			var Team_admin=MJS_User_Info.team_admin;
			if(!Team_admin){
				msgTips('你不是球队队长,不能应战')
				return;
			}
			var info_main_team_id=this.info_main_team.admin_id;
			var info_slave_team_id=this.info_slave_team.admin_id;
			if(info_main_team_id==info_slave_team_id){
				msgTips('不能和自己的战队PK')
				return;
			}
			this.info_selected.invite_id=MJS_URLArry.invite_id;
			this.info_selected.order_type=2;
			this.invite_res.price=this.invite_res.money;
			$.extend(this.info_selected,this.address)
			$.extend(this.info_selected,info_selected_storefront)
			$.extend(this.info_selected,this.invite_res)
			$.extend(this.info_selected,{team_info:this.info_slave_team})
			$.extend(this.info_selected,{invite_res:this.invite_res})
			Post_Browser_Cache('info_order',this.info_selected)
			if(test){
				location.href='/wap/pay/paytest';
			}else{
				location.href='/wap/pay/pay';
			}
		}
	}
})
console.log(vm)
</script>
@endsection

@endsection

